package sk.tramtatiri.pages.users;

import org.apache.wicket.model.Model;

import sk.tramtatiri.MySession;
import sk.tramtatiri.core.IConstants;

public class FoodsPage extends UserPageTemplate{

	public FoodsPage() {
		CollapsibleBorder borderCreate = new CollapsibleBorder("borderCreateFood", new Model("Vytvorit potravinu"), new Model("Vytvorit potravinu"));
		FoodCreatePanel foodCreatePanel = new FoodCreatePanel("foodCreatePanel");
		
		CollapsibleBorder borderShow = new CollapsibleBorder("borderShowFoods", new Model("Zoznam potravín"), new Model("Zoznam potravín"));
		FoodShowPanel foodShowPanel = new FoodShowPanel("foodShowPanel");
		borderShow.setCollapsed(false);
		
		if (((MySession)getSession()).hasPermission()) {
			borderCreate.setVisible(true);
		} else {
			borderCreate.setVisible(false);
		}
		
		borderCreate.add(foodCreatePanel);
		borderShow.add(foodShowPanel);
		add(borderCreate);
		add(borderShow);
	}
	
	@Override
	public String getPageTitle() {
		return IConstants.PAGE_NAME+" - Potraviny";
	}

}
